<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HIWI App</title>
  <style>
    body {
      margin: 0;
      display: flex;
      padding-left: 10px;
      /* justify-content: center;
      align-items: center;
      height: 100vh;
      background-color: #1e1e1e; */
    }
/* 
    #log {
      font-family: 'Courier New', Courier, monospace;
      background-color: #000;
      color: #00ff00;
      padding: 20px;
      border-radius: 10px;
      width: 80%;
      height: 80%;
      overflow-y: auto;
      box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
      border: 2px solid #00ff00;
    }

    #log p {
      margin: 0;
    } */

    /* Scrollbar styling */
    /* #log::-webkit-scrollbar {
      width: 8px;
    }

    #log::-webkit-scrollbar-thumb {
      background-color: #00ff00;
      border-radius: 5px;
    } */
  </style>
</head>
<body>
  <div id="log"></div>

  <script>
    const { ipcRenderer } = require('electron');

    const logContainer = document.getElementById('log');

    ipcRenderer.on('log', (event, message) => {
      const logEntry = document.createElement('p');
      logEntry.textContent = message;
      logContainer.appendChild(logEntry);
      logContainer.scrollTop = logContainer.scrollHeight; // 自动滚动到最新日志
      if (message.includes('10秒后自动关闭应用')) {
        setInterval(() => {
            logEntry.textContent = parseInt(logEntry.textContent) - 1 + '秒后自动关闭应用...';
        }, 1000); // 10秒 = 10000毫秒
      }
    });
  </script>
</body>
</html>